<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<div class="middle myclear">
	<div class="pad10">
		
		<h3><?php echo $lang['send_mail_log']?></h3>
		
		<table class="martop10 marbottom10">
			<tr>
				<td class="pad5 ver-middle">
					<b class="ver-middle marright5">Action: </b>
					<select id="slcType" class="ver-middle">
						<option value="-1">- Tất cả -</option>
						<option value="0" <?php echo ($el_type == 0) ? 'selected="selected"' : '';?> >
							<?php echo $lang['inform_type'][7];?>
						</option>
						<option value="1" <?php echo ($el_type == 1) ? 'selected="selected"' : '';?> >
							<?php echo $lang['inform_type'][14];?>
						</option>
						<option value="2" <?php echo ($el_type == 2) ? 'selected="selected"' : '';?> >
							<?php echo $lang['inform_type'][15];?>
						</option>
						<option value="3" <?php echo ($el_type == 3) ? 'selected="selected"' : '';?> >
							<?php echo $lang['inform_type'][26];?>
						</option>
					</select>
				</td>
				<td class="pad5 ver-middle">
					<b class="ver-middle marright5">User: </b>
					<select id="slcUser" class="ver-middle">
						<option value="0">- Tất cả -</option>
						<?php foreach($usr_list as $row){?>
						<option value="<?php echo $row['user_id']?>" <?php echo ($el_usr == $row['user_id']) ? 'selected="selected"' : '';?> >
							<?php echo $row['username']?>
						</option>
						<?php }?>
					</select>
				</td>
				<td>
					<input type="button" value=" Go " onclick="logFilterChange()" />
				</td>
			</tr>
		</table>
		
		<table class="tb-pad5" width="100%" border="1" style="border-color: #ccc; border-width:  1px 1px; border-collapse:  collapse; background: #fff;" class="martop10">
			<tr>
				<td class="pad5 text-center" width="20">
					#
				</td>
				
				<td class="pad5" width="180" >
					<b>Receive</b>
				</td>
				
				<td class="pad5" width="200" >
					<b>Subject</b>
				</td>
								
				<td class="pad5" width="250" >
					<b>Content</b>
				</td>
				
				<td class="pad5 text-center" >
					<b>Time</b>
				</td>
				<td class="pad5 text-center" >
					<b>Banner</b>
				</td>
				<td class="pad5 text-center" >
					<b>User</b>
				</td>
			</tr>
			<?php $i = 1; foreach ($email_log as $row){?>
			<tr>
				<td class="text-center">
					<?php echo $i?>
				</td>
				<td>
					<?php echo $row['receive']?>
				</td>
				<td>
					<?php echo $row['subject']?>
				</td>
				<td>
					<?php echo $row['content']?>
				</td>
				<td>
					<?php echo $row['timesend']?>
				</td>
				<td>
					[ID:<?php echo $row['bannerid']?>] <?php echo $row['bannername']?>
				</td>
				<td>
					<?php echo $row['username']?>
				</td>
			</tr>
			<?php $i++; }?>
		</table>
		<div class="brv-paging-left padtop10">
			<table class="tbl-list brv-paging" border="1">
				<tr>
					<td class="brv-paging-name">
						<?php echo $lang['page'].' '. $page.' ['.$total_page.']'?>
					</td>
					
					<td class="brv-paging-pre-next">
						<img class="brv-img-pre" alt="previous" src="/images/imgpre.gif" onclick="goPage(<?php echo $page > 1 ? $page - 1 : $page;?>)" />
						<img class="brv-img-next" alt="next" src="/images/imgnext.gif" onclick="goPage(<?php echo $page + 1;?>)" />
					</td>
				</tr>
			</table>
		</div>
	</div>
</div>
<script language="javascript">
function logFilterChange()
{
	var _query = "?";
	_query += "el_type=" + $('#slcType').val();
	_query += "&el_usr=" + $('#slcUser').val();
	
	window.location.href="<?php echo site_url('logs/email/')?>" + _query;
}
function goPage(strVal)
{
	window.location = '<?php echo site_url('logs/email')?>/?el_type=<?php echo $el_type?>&el_usr=<?php echo $el_usr?>&page=' + strVal;
}
</script>